<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>
    div{
      width: 100px;
      height: 100px;
      border: 1px solid red;
    }
    #d1{
      /*绝对定位:元素脱离文档流*/
      position: absolute;
      /*相对于窗口位置做偏移*/
      right: 0;
      bottom: 0;
    }
    #big{
      width: 200px;
      height: 200px;
      background-color: blue;
      margin: 100px 0 0 100px;
    }
    #big>div{
      width: 100px;
      height: 100px;
      background-color: green;
      margin: 50px 0 0 50px ;
      position: relative;/*将相对定位加到哪里，哪里就是参照物*/
    }
    #big>div>div{
      width: 50px;
      height: 50px;
      background-color: red;
      position: absolute;/*绝对定位，以上级相对定位为参照物，若上级元素没有设置相对定位，则默认以窗口为参照物*/
      left: 0;
      top: 0;
    }
  </style>
</head>
<body>
<div id="big">
  <div>
    <div></div>
  </div>
</div>
<div id="d1">div1</div>
<div>div2</div>
<div>div3</div>
</body>
</html>